import {
  config
} from './base.js'; //导入接口的前缀地址

const token = uni.getStorageSync('token') || ''; //获取token


export const Request = (options) => {

  return new Promise((resolve, reject) => {
    uni.request({
      url: config.baseURL + options.url,
      method: options.method || 'GET',
      data: options.data || {},
      timeout: 5000,
      header: {
        'Authorization': token,
        'Content-Type': 'application/json',
      },
      success: (res) => {
        resolve(res);
      },
      fail: (error) => {
        reject(error);
      }
    });
  });
}